

//运行顺序
//父类的静态->子类的静态->父类的实例->父类的构造方法->子类的实例->子类的构造方法


class Myvalue {
    public int val;
    private int val1;

    public int getVal1() {
        return val1;
    }

    public void setVal1(int val1) {
        this.val1 = val1;
    }
}
public class Test {


    public static void swap(Myvalue myV1,Myvalue myV2) {
        int tmp = myV1.val;
        myV1.val = myV2.val;
        myV2.val = tmp;

        //private
        int tmp1 = myV1.getVal1();
        myV1.setVal1(myV2.getVal1());
        myV2.setVal1(tmp1);
    }

    public static void main(String[] args) {
        Myvalue myvalue1 = new Myvalue();
        myvalue1.val = 10;
        Myvalue myvalue2 = new Myvalue();
        myvalue2.val = 20;

        //private
        Myvalue myvalue3 = new Myvalue();
        myvalue3.setVal1(10);
        Myvalue myvalue4 = new Myvalue();
        myvalue4.setVal1(20);

        swap(myvalue1,myvalue2);

        System.out.println(myvalue1.val);
        System.out.println(myvalue2.val);
    }
}
